package sky.wicket;

import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import sky.domain.Country;
import sky.service.CountryService;
import sky.wicket.panels.CountryPanel;

/**
 * Created with IntelliJ IDEA.
 * User: Gauss
 * Date: 17.11.13
 * Time: 18:10
 * To change this template use File | Settings | File Templates.
 */
public class CountryInfo extends BasePage {

    @SpringBean
    CountryService countryService;

    public CountryInfo(PageParameters parameters) {
        addElementsToPage(parameters.get("countryName").toString());
    }

    private void addElementsToPage(String countryName) {
        add(new CountryPanel("panel", new Model<Country>(countryService.getByName(countryName, false))));
    }
}
